package game.metalmax.packet.world {

	import flash.utils.ByteArray;
	
	import game.metalmax.packet.IPacket;

public class EnterSceneResponse implements IPacket{

	//地图ID
	public var mapID:String;
	//场景数据
	public var objects:Array = null;
	private var _PObjectHolder0:PObjectHolder;
	// 场景旋律
	public var themeClass:String;

	public function write(out:ByteArray):void{
		var len:int = 0;
		var i:int = 0;
		out.writeUTF(mapID==null?"":mapID);
		len = objects==null?0:objects.length;
		out.writeShort(len);
		for(i=0;i<len;i++){
			out.writeByte(objects[i]==null?0:1);
		if(objects[i]!=null) objects[i].write(out);
		}
		out.writeUTF(themeClass==null?"":themeClass);
	}
	public function read(inn:ByteArray):void{
		var len:int = 0;
		var i:int = 0;
		mapID = inn.readUTF();
		len = inn.readShort();
		if(len>0){
			objects = new Array();
			for(i=0;i<len;i++){
						if(inn.readByte() == 1){
objects[i]= new PObjectHolder();
objects[i].read(inn);
		}
			}
		}
		themeClass = inn.readUTF();
}
}
}